package com.kancy.learn.rpc.rmi.service.impl;

import com.kancy.learn.rpc.rmi.api.IMessageService;
import com.kancy.learn.rpc.rmi.api.entity.Message;
import com.kancy.learn.rpc.rmi.api.entity.Result;
import com.kancy.learn.rpc.rmi.service.MessageService;

import java.io.Serializable;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;

/**
 * @author kancy
 * @version 1.0
 * @date 2019/1/31 10:45
 */
public class MessageServiceImpl extends UnicastRemoteObject implements IMessageService, MessageService, Serializable {

    public MessageServiceImpl() throws RemoteException {
        super();
    }

    public MessageServiceImpl(int port) throws RemoteException {
        super(port);
    }

    public Result processMessage(Message message) throws RemoteException {
        System.out.println(message);
        Result result = new Result();
        result.setResult(true);
        result.setMsg("ok");
        return result;
    }
}
